package com.leonyr.smartipaddemo.db;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import com.leonyr.smartipaddemo.finger.FingerEntity;
import com.leonyr.smartipaddemo.nfc.UserEntity;

import com.leonyr.smartipaddemo.db.FingerEntityDao;
import com.leonyr.smartipaddemo.db.UserEntityDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig fingerEntityDaoConfig;
    private final DaoConfig userEntityDaoConfig;

    private final FingerEntityDao fingerEntityDao;
    private final UserEntityDao userEntityDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        fingerEntityDaoConfig = daoConfigMap.get(FingerEntityDao.class).clone();
        fingerEntityDaoConfig.initIdentityScope(type);

        userEntityDaoConfig = daoConfigMap.get(UserEntityDao.class).clone();
        userEntityDaoConfig.initIdentityScope(type);

        fingerEntityDao = new FingerEntityDao(fingerEntityDaoConfig, this);
        userEntityDao = new UserEntityDao(userEntityDaoConfig, this);

        registerDao(FingerEntity.class, fingerEntityDao);
        registerDao(UserEntity.class, userEntityDao);
    }
    
    public void clear() {
        fingerEntityDaoConfig.clearIdentityScope();
        userEntityDaoConfig.clearIdentityScope();
    }

    public FingerEntityDao getFingerEntityDao() {
        return fingerEntityDao;
    }

    public UserEntityDao getUserEntityDao() {
        return userEntityDao;
    }

}
